/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package project1;

import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.ImageIcon;
import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;
import javax.swing.SwingUtilities;
import javax.swing.table.DefaultTableModel;

/**
 *
 * @author haihip
 */
public class AnnounceView extends javax.swing.JPanel {

    /**
     * Creates new form AnnounceView
     */
    SqlFunc sql = new SqlFunc();
    public AnnounceView(){
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Windows".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | javax.swing.UnsupportedLookAndFeelException ex) {
        }
        initComponents();
                
        loadinfo();
        hideAdmin();
        final JPopupMenu popup = new JPopupMenu();
        JMenuItem menuItem = new JMenuItem("Mở thông báo",
                new ImageIcon("images/newproject.png"));
        menuItem.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                try {
                    DefaultTableModel defaultModel = (DefaultTableModel) jTable1.getModel();
                    ResultSet getrs = sql.select("select * from thongbao where ID_ThongBao='"+defaultModel.getValueAt(jTable1.getSelectedRow(), 0)+"'");
                    if(getrs.next())
                    {
                        tieude.setText(getrs.getString("tieude"));
                        noidung.setText(getrs.getString("noidung"));
                        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
                        double width = screenSize.getWidth();
                        double height = screenSize.getHeight();
                        showAnnounceDlg.setLocation((int) (width/2-262), (int) (height/2-300));
                       showAnnounceDlg.show(); 
                        if(!sql.query("update thongbao set status='1' where ID_ThongBao='"+defaultModel.getValueAt(jTable1.getSelectedRow(), 0)+"'"))
                        {
                            System.out.println("Có lỗi đánh dấu đã đọc thông báo");
                        }
                    }
                } catch (SQLException ex) {
                    Logger.getLogger(AnnounceView.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        });
        popup.add(menuItem);
        // New File menu item
        menuItem = new JMenuItem("Đánh dấu đã đọc",new ImageIcon("images/newfile.png"));
        menuItem.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                DefaultTableModel defaultModel = (DefaultTableModel) jTable1.getModel();
                if(!sql.query("update thongbao set status='1' where ID_ThongBao='"+defaultModel.getValueAt(jTable1.getSelectedRow(), 0)+"'"))
                {
                    System.out.println("Có lỗi đánh dấu đã đọc thông báo");
                }
                loadinfo();
            }
        });
        popup.add(menuItem);
        menuItem = new JMenuItem("Xoá thông báo",new ImageIcon("images/newfile.png"));
        menuItem.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                 DefaultTableModel defaultModel = (DefaultTableModel) jTable1.getModel();
                if(!sql.query("delete from thongbao where ID_ThongBao='"+defaultModel.getValueAt(jTable1.getSelectedRow(), 0)+"'"))
                {
                    System.out.println("Có lỗi xoá thông báo");
                }
                loadinfo();
            }
        });
        popup.add(menuItem);
        jTable1.addMouseListener(new MouseAdapter() {
 
            @Override      
            public void mouseClicked(MouseEvent me)
            {
                if(SwingUtilities.isRightMouseButton(me) == true)
                {
                    int row = jTable1.rowAtPoint(me.getPoint());
                    jTable1.clearSelection();
                    jTable1.addRowSelectionInterval(row,row);
                    showPopup(me);
                }
            }
            private void showPopup(MouseEvent e) {
             //   if (e.isPopupTrigger()) {
                    popup.show(e.getComponent(),
                            e.getX(), e.getY());
               // }
            }
        });
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        addAnnounceDlg = new javax.swing.JDialog();
        showAnnounceDlg = new javax.swing.JDialog();
        jPanel3 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        tieude = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        noidung = new javax.swing.JTextArea();
        btnClose = new javax.swing.JButton();
        jLabel4 = new javax.swing.JLabel();
        jPanel1 = new javax.swing.JPanel();
        btn_home = new javax.swing.JLabel();
        txt_home = new javax.swing.JLabel();
        btn_addannounce = new javax.swing.JLabel();
        txt_addannounce = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();

        addAnnounceDlg.addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                addAnnounceDlgWindowClosing(evt);
            }
        });

        javax.swing.GroupLayout addAnnounceDlgLayout = new javax.swing.GroupLayout(addAnnounceDlg.getContentPane());
        addAnnounceDlg.getContentPane().setLayout(addAnnounceDlgLayout);
        addAnnounceDlgLayout.setHorizontalGroup(
            addAnnounceDlgLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 400, Short.MAX_VALUE)
        );
        addAnnounceDlgLayout.setVerticalGroup(
            addAnnounceDlgLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 300, Short.MAX_VALUE)
        );

        showAnnounceDlg.setMaximumSize(new java.awt.Dimension(525, 600));
        showAnnounceDlg.setMinimumSize(new java.awt.Dimension(525, 600));
        showAnnounceDlg.setPreferredSize(new java.awt.Dimension(525, 600));
        showAnnounceDlg.setResizable(false);

        jPanel3.setBackground(new java.awt.Color(255, 255, 255));
        jPanel3.setMaximumSize(new java.awt.Dimension(525, 600));
        jPanel3.setMinimumSize(new java.awt.Dimension(525, 600));
        jPanel3.setPreferredSize(new java.awt.Dimension(525, 600));

        jLabel1.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
        jLabel1.setText("Thông Báo");

        jLabel2.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        jLabel2.setText("Tiêu đề:");

        tieude.setEditable(false);

        jLabel3.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        jLabel3.setText("Nội dung:");

        noidung.setEditable(false);
        noidung.setColumns(20);
        noidung.setRows(5);
        jScrollPane2.setViewportView(noidung);

        btnClose.setText("Đóng");
        btnClose.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCloseActionPerformed(evt);
            }
        });

        jLabel4.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        jLabel4.setText("Thời gian:");

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGap(18, 18, 18)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addComponent(jLabel2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(tieude))
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 487, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addComponent(jLabel3)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jLabel4)
                        .addGap(127, 127, 127)))
                .addContainerGap(20, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                .addGap(0, 0, Short.MAX_VALUE)
                .addComponent(jLabel1)
                .addGap(195, 195, 195))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(btnClose, javax.swing.GroupLayout.PREFERRED_SIZE, 96, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(216, 216, 216))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(tieude, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(jLabel4))
                .addGap(18, 18, 18)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 353, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(btnClose, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        javax.swing.GroupLayout showAnnounceDlgLayout = new javax.swing.GroupLayout(showAnnounceDlg.getContentPane());
        showAnnounceDlg.getContentPane().setLayout(showAnnounceDlgLayout);
        showAnnounceDlgLayout.setHorizontalGroup(
            showAnnounceDlgLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(showAnnounceDlgLayout.createSequentialGroup()
                .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGap(0, 0, 0))
        );
        showAnnounceDlgLayout.setVerticalGroup(
            showAnnounceDlgLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        setBackground(new java.awt.Color(255, 255, 255));
        setMaximumSize(new java.awt.Dimension(1024, 700));
        setMinimumSize(new java.awt.Dimension(1024, 700));

        jPanel1.setBackground(new java.awt.Color(250, 249, 249));
        jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jPanel1.setMaximumSize(new java.awt.Dimension(1024, 124));
        jPanel1.setMinimumSize(new java.awt.Dimension(1024, 124));
        jPanel1.setPreferredSize(new java.awt.Dimension(1024, 124));

        btn_home.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        btn_home.setIcon(new javax.swing.ImageIcon(getClass().getResource("/project1/Views/images/home.png"))); // NOI18N
        btn_home.setVerticalAlignment(javax.swing.SwingConstants.TOP);
        btn_home.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        btn_home.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        btn_home.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                btn_homeMouseClicked(evt);
            }
        });

        txt_home.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        txt_home.setText("Thông tin chung");

        btn_addannounce.setIcon(new javax.swing.ImageIcon(getClass().getResource("/project1/Views/images/new_account.png"))); // NOI18N
        btn_addannounce.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                btn_addannounceMouseClicked(evt);
            }
        });

        txt_addannounce.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        txt_addannounce.setText("Thêm thông báo");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(46, 46, 46)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(btn_home)
                    .addComponent(txt_home))
                .addGap(55, 55, 55)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(btn_addannounce)
                    .addComponent(txt_addannounce))
                .addContainerGap(738, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addGap(10, 10, 10)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(btn_home)
                    .addComponent(btn_addannounce))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txt_home)
                    .addComponent(txt_addannounce))
                .addContainerGap())
        );

        jPanel2.setBackground(new java.awt.Color(255, 255, 255));
        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Thông báo"));
        jPanel2.setMaximumSize(new java.awt.Dimension(955, 514));
        jPanel2.setMinimumSize(new java.awt.Dimension(955, 514));
        jPanel2.setPreferredSize(new java.awt.Dimension(955, 514));

        jTable1.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jTable1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "ID", "Tiêu đề", "Thời gian", "Trạng thái"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Integer.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jTable1.setRowHeight(24);
        jTable1.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        jTable1.getTableHeader().setReorderingAllowed(false);
        jScrollPane1.setViewportView(jTable1);
        jTable1.getColumnModel().getSelectionModel().setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        if (jTable1.getColumnModel().getColumnCount() > 0) {
            jTable1.getColumnModel().getColumn(0).setMinWidth(30);
            jTable1.getColumnModel().getColumn(0).setPreferredWidth(30);
            jTable1.getColumnModel().getColumn(0).setMaxWidth(30);
            jTable1.getColumnModel().getColumn(1).setPreferredWidth(300);
            jTable1.getColumnModel().getColumn(3).setResizable(false);
            jTable1.getColumnModel().getColumn(3).setPreferredWidth(50);
        }

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 931, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 478, Short.MAX_VALUE)
                .addContainerGap())
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, Short.MAX_VALUE))
            .addGroup(layout.createSequentialGroup()
                .addGap(36, 36, 36)
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(30, 30, 30)
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 32, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void btn_homeMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btn_homeMouseClicked
        // TODO add your handling code here:
        project1.Frame.setFrame(project1.Frame.homeView);
    }//GEN-LAST:event_btn_homeMouseClicked
    
    void loadinfo()
    {
        DefaultTableModel defaultModel = (DefaultTableModel) jTable1.getModel(); 
        System.out.println(jTable1.getRowCount());
        int num=jTable1.getRowCount();
        for(int i =0;i<num;i++)
        {
            defaultModel.removeRow(0);
        }
        ResultSet rs = sql.select("select * from thongbao order by ID_ThongBao ASC");
        String trangthai="Chưa đọc";
        try {
            while(rs.next())
            {
                if(rs.getString("status").equals("1"))
                    trangthai="Đã đọc";
                else
                    trangthai="Chưa đọc";
               defaultModel.insertRow(0, new Object [] {rs.getString("ID_ThongBao"),rs.getString("tieude"), rs.getString("thoigian"),trangthai});
            }
        } catch (SQLException ex) {
            Logger.getLogger(AnnounceView.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    private void btn_addannounceMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btn_addannounceMouseClicked
        // TODO add your handling code here:
        project1.Frame.homeFrame.setEnabled(false);
        addAnnounceDlg.setVisible(true);
        addAnnounceDlg.setAlwaysOnTop(true);
    }//GEN-LAST:event_btn_addannounceMouseClicked

    private void addAnnounceDlgWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_addAnnounceDlgWindowClosing
        // TODO add your handling code here:
        addAnnounceDlg.setAlwaysOnTop(false);
        project1.Frame.homeFrame.setEnabled(true);
    }//GEN-LAST:event_addAnnounceDlgWindowClosing

    private void btnCloseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCloseActionPerformed
        // TODO add your handling code here:
        showAnnounceDlg.hide();
    }//GEN-LAST:event_btnCloseActionPerformed
    private void hideAdmin()
    {
        if(Project1.User[9].equals("3"))
        {
            btn_addannounce.setVisible(true);
            txt_addannounce.setVisible(true);
        }
        else
        {
            btn_addannounce.setVisible(false);
            txt_addannounce.setVisible(false);
        }
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JDialog addAnnounceDlg;
    private javax.swing.JButton btnClose;
    private javax.swing.JLabel btn_addannounce;
    private javax.swing.JLabel btn_home;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JTable jTable1;
    private javax.swing.JTextArea noidung;
    private javax.swing.JDialog showAnnounceDlg;
    private javax.swing.JTextField tieude;
    private javax.swing.JLabel txt_addannounce;
    private javax.swing.JLabel txt_home;
    // End of variables declaration//GEN-END:variables
    private DefaultTableModel model;
}
